package util;
import com.mongodb.MongoClientSettings;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoDatabase;
import org.bson.codecs.configuration.CodecRegistries;
import org.bson.codecs.configuration.CodecRegistry;
import org.bson.codecs.pojo.PojoCodecProvider;
public class MongoDBUtil {
    private static final String CONNERTION_STRING="mongdb://127.0.0.1:27017";
    private static final String DATABASE_NAME = "test_project";
    public static  MongoDatabase getConnect(){
       MongoClient mongoClient=MongoClients.create(CONNERTION_STRING);
        return mongoClient.getDatabase(DATABASE_NAME);
    }
    public static CodecRegistry getCodeRegistry(){
        return CodecRegistries.fromRegistries(MongoClientSettings.getDefaultCodecRegistry(),CodecRegistries.fromProviders(PojoCodecProvider.builder().automatic(true).build()));
  }

}
